package com.sitanyun.merchant.guide.adapter;

import android.content.Context;
import android.graphics.Color;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sitanyun.merchant.guide.R;
import com.sitanyun.merchant.guide.bean.QueryuserMoneyBean;

/**
 * Created by
 * on 2022/1/15.
 * 我的奖励适配器
 */
public class UserMoneyAdapter extends BaseQuickAdapter<QueryuserMoneyBean.DataBean.RecordsBean, BaseViewHolder> {

    private TextView view;

    public UserMoneyAdapter(Context context) {
        super(R.layout.moneylist_item);
        this.mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, QueryuserMoneyBean.DataBean.RecordsBean item) {
  helper.setText(R.id.money_income,item.getType())
          .setText(R.id.money_handle,item.getPayStatus())
         // .setText(R.id.money_money,item.getMoney()+"")
          .setText(R.id.money_user,item.getNote())
          .setText(R.id.money_time,item.getTime());
  if (item.getPayStatus().equals("发放失败")){
      helper.setTextColor(R.id.money_handle, Color.parseColor("#333333"));
      //helper.setBackgroundColor(R.id.money_handle,"#534534534");
  }else {
      helper.setTextColor(R.id.money_handle, Color.parseColor("#428AEC"));
  }
      String money=  item.getMoney()+"";
  if (money.contains("-")){
      helper.setText(R.id.money_money,""+item.getMoney())
              .setTextColor(R.id.money_money, Color.parseColor("#00AD19"));
  }else {
      helper .setTextColor(R.id.money_money, Color.parseColor("#ffff0000"))
              .setText(R.id.money_money,"+"+item.getMoney());
  }
    }
}